package com.net.util;

import com.net.controller.model.Meta;
import com.net.controller.model.ResponseModel;
import com.net.controller.model.ResponseModelAndPageParam;
import com.net.controller.vo.PageParam;
import com.net.service.vo.ServiceCode;

/**
 * 参数返回工具
 * 
 *
 */
public class ResultHelper {
	
	
	public static ResponseModel createResult(Integer code,String message,Object data) {
		ResponseModel responseModel  = new ResponseModel();
		Meta meta = new Meta(code,message);
//		responseModel.setMeta(meta);
		responseModel.setCode(code);
		responseModel.setData(data);
		responseModel.setMessage(message);
		return responseModel;
		
	}
	
	public static ResponseModel createResult(Integer code,String message) {
		ResponseModel responseModel = new ResponseModel();

		        responseModel.setCode(code);
				responseModel.setMessage(message);
				responseModel.setData(null);
				return responseModel;		
	}
	
	
	public static ResponseModel createOkResult(Object data){
		ResponseModel responseModel = new ResponseModel();
//		Meta meta =new Meta(ServiceCode.SUCCESS,"");
		responseModel.setData(data);
		responseModel.setCode(ServiceCode.SUCCESS);
		responseModel.setMessage("");
		return responseModel;
	}
	
	public static  ResponseModel createOkResultAndMessage(String message,Object data) {
		ResponseModel responseModel = new ResponseModel();
		responseModel.setData(data);
		responseModel.setCode(ServiceCode.SUCCESS);
		responseModel.setMessage(message);
		return responseModel;		
	}
	
	
	public static ResponseModelAndPageParam createOkResultAndPageParam(Object data,PageParam pageParam){
		ResponseModelAndPageParam responseModelAndPageParam = new ResponseModelAndPageParam();
		responseModelAndPageParam.setData(data);
		responseModelAndPageParam.setPageParam(pageParam);
		responseModelAndPageParam.setCode(ServiceCode.SUCCESS);
		responseModelAndPageParam.setMessage("");
		
		return responseModelAndPageParam;
	}
	

}
